export default Vue => {
  Vue.directive('contenteditable', {
    twoWay: true,
    bind: function () {
      this.handler = function () {
        this.set(this.el.innerHTML)
      }.bind(this)
      this.el.addEventListener('keyup', this.handler)
    },
    update: function (newValue, oldValue) {
      this.el.innerHTML = newValue || ''
    },
    unbind: function () {
      this.el.removeEventListener('keyup', this.handler)
    }
  })
}
